"use strict";
define(["commonUI", "laydate", "template","global", "validate", "select2", "ztree", "plupload"], function (
    commonUI, laydate, template,global
) {
    var user = null;
    var currProjectId = null;
    //通用数据项配置新增 选择采集点框
    var app = {
        init: function () {
          user = global.getLoginUser();
          $(".username").text(user.userName);
          // 初始化项目导航
          this.initProjectNav();
          //初始化通用数据项列表
          this.initCommonDataItem();
          //初始化系统能耗
          this.initSystemPowercost();
          //初始化制冷/供暖量
          this.initCoolingAndHeatingEnergy();
          //初始化能耗占比
          this.initPowercostRate();
          //初始化机组能效
          this.initMachineGroup();
          //初始化三项数据
          this.initThreeRealTime();
          //初始化系统能效
          this.initSystemEnffiency();
          //初始化冷热水泵输送系数
          this.initLengreshuibeng();
          //初始化地源热泵输送系统
          this.initDiyuanrebeng();
          this.eventBind();
        },
        initProjectNav:function(){
          global.get("/admin/project/listByUser",function(response){
            var first = true;
            response.data.projects.forEach(element => {
              if(first){
                var name = element.name;
                if(name.length>=12){
                  name = name.substr(0,12) + "...";
                }
                $(".project-list").append("<li projectId = "+element.id+" class='active'>"+name+"</li>");
                currProjectId = element.id;
                first = false;
              }else{
                var name = element.name;
                if(name.length>=12){
                  name = name.substr(0,12) + "...";
                }
                $(".project-list").append("<li projectId = "+element.id+">"+name+"</li>")
              }
            });
          },null,null,false)
        },
        initCommonDataItem:function(){
            $("#div1").html("");
            global.get("/admin/statisticsConfig/dataConfig/list?projectId="+currProjectId,function(response){
              response.data.commonDataConfigList.forEach(element=>{
                var str = element.name + "="
                element.deviceNames.forEach(name=>{
                  str += name + "+";
                })
                str = str.substr(0,str.length-1)
                $("#div1").append('<div class="info-con"><div class="info-header"><span class="info-header-text">'+element.name+'</span><a class="edit-btn pull-right" data-id="c'+element.id+'" data-type="1" data-name="'+element.name+'"><i class="aidicon aidicon-clipboard-check"></i>编辑</a><a class="del-btn pull-right" dataConfigId="'+element.id+'" type="commonDataConfig"><i class="aidicon aidicon-delete"></i>删除</a></div><div class="info-wrap text-overflow" title="'+str+'">'+str+'</div></div>')
              })
            })
        },
        initSystemPowercost:function(){
          $("#div2").html("");
          //制冷系统能耗
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=8",function(response){
            var cooling = response.data.names;
            // var heating = null;
            // global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=9",function(response){
            //   heating = response.data.names;
              var str = "制冷/供暖系统能耗=";
              // if(heating!=null){
              //   heating.forEach(element=>{
              //     str += element + "+";
              //   });
              // }
              if(cooling!=null){
                cooling.forEach(element=>{
                  str += element + "+";
                });
              }
              str = str.substr(0,str.length-1);
              $("#div2").append('<div class="info-con"><div class="info-header"><span class="info-header-text">制冷/供暖系统能耗</span><a class="edit-btn pull-right" data-id="s8" data-type="2"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+str+'">'+str+'</div></div>')
              // str = "制冷/系统能耗=";
              
            //   str = str.substr(0,str.length-1);
            //   $("#div2").append('<div class="info-con"><div class="info-header"><span class="info-header-text">制冷系统能耗</span><a class="edit-btn pull-right" data-id="s8" data-type="2"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+str+'">'+str+'</div></div>')
            // });
          })
        },
        initCoolingAndHeatingEnergy:function(){
          $("#div9").html("");
          //制冷系统能耗
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=4",function(response){
            var cooling = response.data.names;
            var heating = null;
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=3",function(response){
              heating = response.data.names;
              var str = "制热量=";
              if(heating!=null){
                heating.forEach(element=>{
                  str += element + "+";
                });
              }
              str = str.substr(0,str.length-1);
              $("#div9").append('<div class="info-con"><div class="info-header"><span class="info-header-text">制热量统计</span><a class="edit-btn pull-right" data-id="s3" data-type="2"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+str+'">'+str+'</div></div>')
              str = "制冷量=";
              if(cooling!=null){
                cooling.forEach(element=>{
                  str += element + "+";
                });
              }
              str = str.substr(0,str.length-1);
              $("#div9").append('<div class="info-con"><div class="info-header"><span class="info-header-text">制冷量统计</span><a class="edit-btn pull-right" data-id="s4" data-type="2"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+str+'">'+str+'</div></div>')
            });
          })
        },
        initPowercostRate:function(){
          $("#div3").html("");
          global.get("/admin/statisticsConfig/powercostRateConfig/list?projectId="+currProjectId,function(response){
            var fenmu = "";
            response.data.rateTypes.forEach(element=>{
              element.deviceNames.forEach(name=>{
                fenmu += name + "+";
              })
            })
            fenmu = fenmu.substr(0,fenmu.length-1)
            response.data.rateTypes.forEach(element=>{
              var fenzi = "";
              element.deviceNames.forEach(name=>{
                fenzi += name + "+";
              })
              fenzi = fenzi.substr(0,fenzi.length-1)
              $("#div3").append('<div class="info-con"><div class="info-header"><span class="info-header-text">'+element.name+'</span><a class="edit-btn pull-right" data-type="3" data-id="r'+element.id+'" data-name="'+element.name+'"><i class="aidicon aidicon-clipboard-check"></i>编辑</a><a class="del-btn pull-right" type="rateType" rateTypeId="'+element.id+'"><i class="aidicon aidicon-delete"></i>删除</a></div><div class="info-box"><div class="info-label">'+element.name+'=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div></div>')
            })
          })
        },
        initMachineGroup:function(){
          $("#div4").html("");
          global.get("/admin/statisticsConfig/machineGroup/list?projectId="+currProjectId,function(response){
            response.data.machineGroups.forEach(element=>{
              var fenzi = "";
              var fenmu = "";
              element.energyNames.forEach(name=>{
                fenmu+=name+"+";
              });
              element.powercostNames.forEach(name=>{
                fenzi+=name+"+";
              });
              fenzi = fenzi.substr(0,fenzi.length-1)
              fenmu = fenmu.substr(0,fenmu.length-1)
              $("#div4").append('<div class="info-con"><div class="info-header"><span class="info-header-text">'+element.name+'</span><a class="edit-btn pull-right" data-type="4" data-id1="g'+element.id+'_1" data-id2="g'+element.id+'_0" data-name="'+element.name+'"><i class="aidicon aidicon-clipboard-check"></i>编辑</a><a class="del-btn pull-right" type="machineGroup" machineGroupId="'+element.id+'"><i class="aidicon aidicon-delete"></i>删除</a></div><div class="info-box"><div class="info-label">'+element.name+'=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>');
            })
          })
        },
        initThreeRealTime:function(){
          $("#div5").html("");
          global.get("/admin/statisticsConfig/equipmentMonitor/threeRealTime?projectId="+currProjectId,function(response){
            var outdoorTemperature=response.data.outdoorTemperature.length>0?response.data.outdoorTemperature[0]:"";
            var outdoorHumidity= response.data.outdoorHumidity.length>0?response.data.outdoorHumidity[0]:"";
            var solarRadiation=  response.data.solarRadiation.length>0?response.data.solarRadiation[0]:"";
            $("#div5").append('<div class="info-con"><div class="info-header"><span class="info-header-text">室外温度</span><a class="edit-btn pull-right" data-type="6" data-id="e10"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+outdoorTemperature+'">室外温度='+outdoorTemperature+'</div></div>')  
            $("#div5").append('<div class="info-con"><div class="info-header"><span class="info-header-text">室外湿度</span><a class="edit-btn pull-right" data-type="6" data-id="e11"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+outdoorHumidity+'">室外湿度='+outdoorHumidity+'</div></div>')            
            $("#div5").append('<div class="info-con"><div class="info-header"><span class="info-header-text">太阳辐射强度</span><a class="edit-btn pull-right" data-type="6" data-id="e12"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-wrap text-overflow" title="'+solarRadiation+'">太阳辐射强度='+solarRadiation+'</div></div>')                      
            })
        },
        initSystemEnffiency:function(){
          $("#div6").html("");
          //初始化供冷能效
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=2",function(response){
            var fenmu = "";
            if(response.data.names!=null){
              response.data.names.forEach(element=>{
                fenmu += element + "+";
              })
            }
            fenmu = fenmu.substr(0,fenmu.length-1);
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=4",function(response){
              var fenzi = ""
              if(response.data.names!=null){
                response.data.names.forEach(element=>{
                  fenzi += element + "+";
                });
              }
              fenzi = fenzi.substr(0,fenzi.length-1);
              $("#div6").append('<div class="info-con"><div class="info-header"><span class="info-header-text">制冷系统能效</span><a class="edit-btn pull-right" data-id1="s4" data-id2="s8" data-type="5"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-box"><div class="info-label">制冷系统能效=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>')
            },null,null,false);
          },null,null,false)
          //初始化制暖能效
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=1",function(response){
            var fenmu = "";
            if(response.data.names!=null){
              response.data.names.forEach(element=>{
                fenmu += element + "+";
              })
            }
            fenmu = fenmu.substr(0,fenmu.length-1);
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=3",function(response){
              var fenzi = ""
              if(response.data.names!=null){
                response.data.names.forEach(element=>{
                  fenzi += element + "+";
                });
              }
              fenzi = fenzi.substr(0,fenzi.length-1);
              $("#div6").append('<div class="info-con"><div class="info-header"><span class="info-header-text">供暖系统能效</span><a class="edit-btn pull-right"  data-id1="3" data-id2="9" data-type="5"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-box"><div class="info-label">供暖系统能效=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>')
            },null,null,false);
          },null,null,false)
        },
        initLengreshuibeng:function(){
          $("#div7").html("");
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=19",function(response){
            var fenmu = "";
            if(response.data.names!=null){
              response.data.names.forEach(element=>{
                fenmu += element + "+";
              })
            }
            fenmu = fenmu.substr(0,fenmu.length-1);
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=20",function(response){
              var fenzi = ""
              if(response.data.names!=null){
                response.data.names.forEach(element=>{
                  fenzi += element + "+";
                });
              }
              fenzi = fenzi.substr(0,fenzi.length-1);
              $("#div7").append('<div class="info-con"><div class="info-header"><span class="info-header-text">冷热水泵输送系数</span><a class="edit-btn pull-right" data-id1="s20" data-id2="s19" data-type="7"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-box"><div class="info-label">冷热水泵输送系数=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>')
            },null,null,false);
          },null,null,false)
        },
        initDiyuanrebeng:function(){
          $("#div8").html("");
          //夏季地源热泵系数
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=21",function(response){
            var fenmu = "";
            if(response.data.names!=null){
              response.data.names.forEach(element=>{
                fenmu += element + "+";
              })
            }
            fenmu = fenmu.substr(0,fenmu.length-1);
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=22",function(response){
              var fenzi = ""
              if(response.data.names!=null){
                response.data.names.forEach(element=>{
                  fenzi += element + "+";
                });
              }
              fenzi = fenzi.substr(0,fenzi.length-1);
              $("#div8").append('<div class="info-con"><div class="info-header"><span class="info-header-text">地源水泵输送系数（供冷季节、夏季）</span><a class="edit-btn pull-right" data-id1="s22" data-id2="s21" data-type="8"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-box"><div class="info-label">地源水泵输送系数=</div><div class="info-percent"><div class="info-num text-overflow" title="'+fenzi+'">'+fenzi+'</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>')
            },null,null,false);
          },null,null,false)

          //冬季地源热泵系数
          global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=26",function(response){
            var fenmu = "";
            if(response.data.names!=null){
              response.data.names.forEach(element=>{
                fenmu += element + "+";
              })
            }
            fenmu = fenmu.substr(0,fenmu.length-1);
            global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=27",function(response){
              var fenzibeijian = ""
              if(response.data.names!=null){
                response.data.names.forEach(element=>{
                  fenzibeijian += element + "+";
                });
              }
              fenzibeijian = fenzibeijian.substr(0,fenzibeijian.length-1);
              global.get("/admin/statisticsConfig/statisticsConfig/plusDetailShow?projectId="+currProjectId + "&statisticsTypeId=23",function(response){
                var fenzijianshu = ""
                if(response.data.names!=null){
                  response.data.names.forEach(element=>{
                    fenzijianshu += element + "+";
                  });
                }
                fenzijianshu = fenzijianshu.substr(0,fenzijianshu.length-1);
                $("#div8").append('<div class="info-con"><div class="info-header"><span class="info-header-text">地源水泵输送系数（供暖季节、冬季）</span><a class="edit-btn pull-right" data-id1="s27" data-id2="s23" data-id3="s26" data-type="9"><i class="aidicon aidicon-clipboard-check"></i>编辑</a></div><div class="info-box"><div class="info-label">地源水泵输送系数=</div><div class="info-percent"><div class="info-num text-overflow" title="('+fenzibeijian+")-("+fenzijianshu+')">('+fenzibeijian+")-("+fenzijianshu+')</div><div class="split-line"></div><div class="info-num text-overflow" title="'+fenmu+'">'+fenmu+'</div></div></div></div>')
              },null,null,false);
            },null,null,false);
          },null,null,false)
        },
        initInputSelect: function (id,type,num) {
          $("#dropdownSelect-treeSelect-multi"+id).dropdownSelect({container:'body',type: 'multi'});
          var setting = {
              check: {
                  enable: true
              },
              data: {
                  simpleData: {
                      enable: true
                  }
              },
              callback:{
                  onCheck:onCheck
              }
          };
          var zNodes = [];
          if(type==0){
            //type==0时，num表示dataConfigId或者设备检测页面三项数据的展示
            //用c+id表示dataConfigId
            //用e+id表示设备检测页面的三项数据
            //当num==null时表示是添加数据不用回显
            var dataId="";
            if(num!=null){
              dataId="?dataId="+num;
            }
            global.get("/admin/statisticsConfig/devices/listAll/"+currProjectId+dataId,function(response){
              response.data.devices.forEach(function(element){
                zNodes.push({
                  id:element.deviceId,
                  name:element.deviceName,
                  checked:element.selected,
                  open:true
                })
              })
            },null,null,false)
          }else if(type==1){
            //type==1时，num表示statisticsConfigId或者机组ID耗电量占比ID等
            //用s+id表示statisticsConfigId
            //用r+id表示耗电量占比ID
            //用g+id表示耗电量占比ID g+machineGroupId+&+type
            //当num==null时表示是添加数据不用回显
            var dataId="";
            if(num!=null){
              dataId="?dataId="+num;
            }
            global.get("/admin/statisticsConfig/deviceAndDataConfig/list/" + currProjectId+dataId,function(response){
              var devices = response.data.devices;
              var dataConfigs =response.data.dataConfigs;
              zNodes.push({
                id:"c0",
                name:"通用数据项",
                open:true
              });
              dataConfigs.forEach(element=>{
                zNodes.push({
                  id:element.deviceId,
                  name:element.deviceName,
                  checked:element.selected,
                  pId:"c0"
                })
              })
              zNodes.push({
                id:"d0",
                name:"采集点",
                open:true
              });
              devices.forEach(element=>{
                zNodes.push({
                  id:element.deviceId,
                  name:element.deviceName,
                  checked:element.selected,
                  pId:"d0"
                })
              })
            },null,null,false)
          }
          $("#treeDemo-"+id).html("");
          var treeSelectObj2 = $.fn.zTree.init($("#treeDemo-"+id), setting, zNodes);
          function onCheck(){
              var nodes = treeSelectObj2.getCheckedNodes(true);
              var checkedNodes = [];
              for(var i = 0; i < nodes.length; i++){
                  var obj = {};
                  obj['text'] = nodes[i]['name'];
                  obj['value'] = nodes[i]['name'];
                  checkedNodes.push(obj);
              }
              $("#dropdownSelect-treeSelect-multi"+id).dropdownSelect("setChecked",checkedNodes);
          }
          $('#dropdownSelect-treeSelect-multi'+id).on('removen.bs.dropdownSelect', function (e) {
              var tree = $.fn.zTree.getZTreeObj('treeDemo-'+id);
              var objs =  _.where(tree.getCheckedNodes(true), { 'name': e.value});
              var obj = objs[0];
              tree.checkNode(obj,false,true);
              onCheck();
          })
          return treeSelectObj2;
        },
        /** 事件绑定 */
        eventBind: function () {
            // 新增
            $('#add1').on('click', function () {
              var treeSelect = null;
              Dialog.open({
                theme: "addFormDialog",
                id: 'dialog-example11',
                title: '新增通用项配置',
                width: 480,
                height: 350,
                modal: true,
                context: self,
                content: template("addFormTpl",{type: 1}),
                onShow: function () {
                  treeSelect=app.initInputSelect(29,0);
                },
                onClosed: function () {
                  $(".dropdownSelect-menu").remove();
                  // $("#_idlg_mask_").remove();
                  // $(".dropdownSelect-menu .dropdownSelect-menu-demo2").remove();
                },
                button: [
                  { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                    if (!$(".addForm").valid()) {
                      return false;
                    }
                    var deviceIds = [];
                    treeSelect.getCheckedNodes().forEach(element=>{
                      deviceIds.push(element.id);
                    });
                    var name = $("#prjId").val();
                    global.post("/admin/statisticsConfig/dataConfig/config?projectId="+currProjectId + "&name="+name + "&deviceIds="+deviceIds,function(response){
                        
                      if(response.success){
                          Dialog.toast("操作成功", {"intent":"success"});
                          app.initCommonDataItem();
                        }else{
                          Dialog.toast(response.message, {"intent":"warn"});
                        }
                    })
                   } },
                  { id: "mybtn2", label: "取消", click: function () {
                   } }
              ]
              });
            });
            $('#add3').on('click', function () {
              var treeSelect = null;
              Dialog.open({
                theme: "addFormDialog",
                id: 'dialog-example11',
                title: '新增设备耗电量占比类别',
                width: 480,
                height: 350,
                modal: true,
                context: self,
                content: template("addFormTpl",{type: 3}),
                onShow: function () {
                    treeSelect = app.initInputSelect(29,1);
                },
                onClosed: function () {
                  $(".dropdownSelect-menu").remove();
                },
                button: [
                  { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () { 
                    if (!$(".addForm").valid()) {
                      return false;
                    }
                    var rateName=$("#prjId").val();
                    var nodes = treeSelect.getCheckedNodes(true);
                    var deviceIds = [];
                    var dataConfigIds = [];
                    nodes.forEach(element=>{
                      if(element.pId=="c0"){
                        dataConfigIds.push(element.id);
                      }else if(element.pId=="d0"){
                        deviceIds.push(element.id);
                      }
                    })
                    global.post("/admin/statisticsConfig/powercostRateConfig/config?projectId="+currProjectId + "&rateName="+rateName + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                      if(response.success){
                        Dialog.toast("操作成功", {"intent":"success"});
                        app.initPowercostRate();
                      }else{
                        Dialog.toast(response.message, {"intent":"warn"});
                      }
                     })
                  } },
                  { id: "mybtn2", label: "取消", click: function () { } }
              ]
              });
            });
            $('#add4').on('click', function () {
              var treeSelect1 = null;
              var treeSelect2 = null;
              Dialog.open({
                theme: "addFormDialog",
                id: 'dialog-example11',
                title: '新增机组能效类别',
                width: 480,
                height: 400,
                modal: true,
                context: self,
                content: template("addFormTpl",{type: 8}),
                onShow: function () {
                    treeSelect1 = app.initInputSelect(29,1);
                    treeSelect2 = app.initInputSelect(30,1);
                },
                onClosed: function () {
                  $(".dropdownSelect-menu").remove();
                },
                button: [
                  { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () { 
                    if (!$(".addForm").valid()) {
                      return false;
                    }
                    var machineGroupName=$("#prjId").val();
                    var nodes = treeSelect1.getCheckedNodes(true);
                    var fenzideviceIds = [];
                    var fenzidataConfigIds = [];
                    nodes.forEach(element=>{
                      if(element.pId=="c0"){
                        fenzidataConfigIds.push(element.id);
                      }else if(element.pId=="d0"){
                        fenzideviceIds.push(element.id);
                      }
                    })
                    var nodes = treeSelect2.getCheckedNodes(true);
                    var fenmudeviceIds = [];
                    var fenmudataConfigIds = [];
                    nodes.forEach(element=>{
                      if(element.pId=="c0"){
                        fenmudataConfigIds.push(element.id);
                      }else if(element.pId=="d0"){
                        fenmudeviceIds.push(element.id);
                      }
                    })
                    global.post("/admin/statisticsConfig/machineGroup/config?projectId="+currProjectId + "&machineGroupName="+machineGroupName + "&energyDeviceIds="+fenzideviceIds + "&energyDataConfigIds="+fenzidataConfigIds + "&powcostDeviceIds="+fenmudeviceIds + "&powercostDataConfigIds="+fenmudataConfigIds,response=>{
                      if(response.success){
                        Dialog.toast("操作成功", {"intent":"success"});
                        app.initMachineGroup();
                      }else{
                        Dialog.toast(response.message, {"intent":"warn"});
                      }
                     })
                  } },
                  { id: "mybtn2", label: "取消", click: function () { } }
              ]
              });
            });
            // 编辑
            $(document).on("click", ".edit-btn", function () {
                var code=$(this).data("type");
                var title = $(this).parents(".info-header").find(".info-header-text").text();
                //通用配置项编辑
                if(code==1) {
                  var treeSelect = null;
                  var name = $(this).data("name");
                  var dataConfigId = $(this).data("id");
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑'+title,
                    width: 480,
                    height: 350,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 1,name:name}),
                    onShow: function () {
                      treeSelect=app.initInputSelect(29,0,dataConfigId);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () { 
                        if (!$(".addForm").valid()) {
                          return false;
                        }
                        var deviceIds = [];
                        treeSelect.getCheckedNodes().forEach(element=>{
                          deviceIds.push(element.id);
                        });
                        var name = $("#prjId").val();
                        global.post("/admin/statisticsConfig/dataConfig/config?projectId="+currProjectId + "&name="+name + "&deviceIds="+deviceIds,function(response){
                            
                          if(response.success){
                              Dialog.toast("操作成功", {"intent":"success"});
                              app.initCommonDataItem();
                            }else{
                              Dialog.toast(response.message, {"intent":"warn"});
                            }
                        })
                      } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                } else if (code==2) {
                  var treeSelect;
                  var dataId=$(this).data("id");
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑'+title,
                    width: 480,
                    height: 280,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 2}),
                    onShow: function () {
                        treeSelect = app.initInputSelect(29,1,dataId);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var num;
                        if(title=="供暖系统能耗"){
                          num = 9;
                        }else if(title=="制冷系统能耗"){
                          num = 8;
                        } else if(title=="制热量统计"){
                          num = 3;
                        }else if(title=="制冷量统计"){
                          num = 4;
                        }
                        var nodes = treeSelect.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId!=null){
                            if(element.pId[0]=="c"){
                              dataConfigIds.push(element.id);
                            }else if(element.pId[0]=="d"){
                              deviceIds.push(element.id);
                            }
                          }
                        })
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+num + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            Dialog.toast("操作成功", {"intent":"success"});
                            if(num==8 || num==9){
                              app.initSystemPowercost();
                            }else if(num==4 || num==3){
                              app.initCoolingAndHeatingEnergy();
                            }
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        },null,null,false)
                       } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                } else if (code==3) {
                  var treeSelect = null;
                  var name = $(this).data("name");
                  var dataId = $(this).data("id");
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑'+title,
                    width: 480,
                    height: 350,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 3,name:name}),
                    onShow: function () {
                        treeSelect = app.initInputSelect(29,1,dataId);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        if (!$(".addForm").valid()) {
                          return false;
                        }
                        var rateName=$("#prjId").val();
                        var nodes = treeSelect.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId=="c0"){
                            dataConfigIds.push(element.id);
                          }else if(element.pId=="d0"){
                            deviceIds.push(element.id);
                          }
                        })
                        global.post("/admin/statisticsConfig/powercostRateConfig/config?projectId="+currProjectId + "&rateName="+rateName + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            Dialog.toast("操作成功", {"intent":"success"});
                            app.initPowercostRate();
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                         })
                       } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                }else if(code==4){
                  var dataId1=$(this).data("id1");
                  var dataId2=$(this).data("id2");
                  console.log(dataId1)
                  console.log(dataId2)
                  var title = $(this).parents(".info-header").find(".info-header-text").text();
                  var treeSelect1 = null;
                  var treeSelect2 = null;
                  var name = $(this).data("name");
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑'+title,
                    width: 480,
                    height: 400,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 8,name:name}),
                    onShow: function () {
                        treeSelect1 = app.initInputSelect(29,1,dataId1);
                        treeSelect2 = app.initInputSelect(30,1,dataId2);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () { 
                        if (!$(".addForm").valid()) {
                          return false;
                        }
                        var machineGroupName=$("#prjId").val();
                        var nodes = treeSelect1.getCheckedNodes(true);
                        var fenzideviceIds = [];
                        var fenzidataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId=="c0"){
                            fenzidataConfigIds.push(element.id);
                          }else if(element.pId=="d0"){
                            fenzideviceIds.push(element.id);
                          }
                        })
                        var nodes = treeSelect2.getCheckedNodes(true);
                        var fenmudeviceIds = [];
                        var fenmudataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId=="c0"){
                            fenmudataConfigIds.push(element.id);
                          }else if(element.pId=="d0"){
                            fenmudeviceIds.push(element.id);
                          }
                        })
                        global.post("/admin/statisticsConfig/machineGroup/config?projectId="+currProjectId + "&machineGroupName="+machineGroupName + "&energyDeviceIds="+fenzideviceIds + "&energyDataConfigIds="+fenzidataConfigIds + "&powcostDeviceIds="+fenmudeviceIds + "&powercostDataConfigIds="+fenmudataConfigIds,response=>{
                          if(response.success){
                            Dialog.toast("操作成功", {"intent":"success"});
                            app.initMachineGroup();
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                         })
                      } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                  ]
                  });
                } else if (code==5) {
                  var title = $(this).parents(".info-header").find(".info-header-text").text();
                  var dataId1=$(this).data("id1");
                  var dataId2=$(this).data("id2");
                  var treeSelect1 = null;
                  var treeSelect2 = null;
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑'+title,
                    width: 480,
                    height: 350,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 10}),
                    onShow: function () {
                      treeSelect1 = app.initInputSelect(29,1,dataId1);
                      treeSelect2 = app.initInputSelect(30,1,dataId2);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var powercost;
                        var energy;
                        if(title=="供暖系统能效"){
                          powercost = 1;
                          energy = 3;
                        }else if(title=="制冷系统能效"){
                          powercost = 2;
                          energy = 4;
                        }
                        var nodes = treeSelect1.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId!=null){
                            if(element.pId[0]=="c"){
                              dataConfigIds.push(element.id);
                            }else if(element.pId[0]=="d"){
                              deviceIds.push(element.id);
                            }
                          }
                        })
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+energy + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            nodes = treeSelect2.getCheckedNodes(true);
                            deviceIds = [];
                            dataConfigIds = [];
                            nodes.forEach(element=>{
                              if(element.pId!=null){
                                if(element.pId[0]=="c"){
                                  dataConfigIds.push(element.id);
                                }else if(element.pId[0]=="d"){
                                  deviceIds.push(element.id);
                                }
                              }
                            })
                            global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+powercost + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initSystemEnffiency();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            },null,null,false)
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        },null,null,false);
                        
                       } },
                      { id: "mybtn2", label: "取消", click: function () { 
                        
                      } }
                    ]
                  })
                }else if (code==6) {
                  var title = $(this).parents(".info-header").find(".info-header-text").text();
                  var statisticsTypeId=$(this).data("id")
                  var treeSelect = null;
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: title+'配置',
                    width: 480,
                    height: 280,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 6}),
                    onShow: function () {
                        treeSelect = app.initInputSelect(29,0,statisticsTypeId);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var num = null;
                        if(title=="室外温度"){
                          num=10;
                        }else if(title=="室外湿度"){
                          num=11;
                        }else if(title=="太阳辐射强度"){
                          num=12;
                        }
                        var deviceIds = [];
                        treeSelect.getCheckedNodes().forEach(element=>{
                        deviceIds.push(element.id);
                    });
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+num + "&deviceIds="+deviceIds,response=>{
                          if(response.success){
                            Dialog.toast("操作成功", {"intent":"success"});
                            app.initThreeRealTime();
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        });
                       } },
                      { id: "mybtn2", label: "取消", click: function () { 

                      } }
                    ]
                  });
                } else if (code==7) {
                  var dataId1=$(this).data("id1");
                  var dataId2=$(this).data("id2");
                  var treeSelect1 = null;
                  var treeSelect2 = null;
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑冷热水泵输送系数配置',
                    width: 480,
                    height: 350,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 7}),
                    onShow: function () {
                        treeSelect1=app.initInputSelect(29,1,dataId1);
                        treeSelect2=app.initInputSelect(30,1,dataId2);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var powercost=20;
                        var energy=19;
                        var nodes = treeSelect2.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId!=null){
                            if(element.pId[0]=="c"){
                              dataConfigIds.push(element.id);
                            }else if(element.pId[0]=="d"){
                              deviceIds.push(element.id);
                            }
                          }
                        })
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+energy + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            nodes = treeSelect1.getCheckedNodes(true);
                            deviceIds = [];
                            dataConfigIds = [];
                            nodes.forEach(element=>{
                              if(element.pId!=null){
                                if(element.pId[0]=="c"){
                                  dataConfigIds.push(element.id);
                                }else if(element.pId[0]=="d"){
                                  deviceIds.push(element.id);
                                }
                              }
                            })
                            global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+powercost + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initLengreshuibeng();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            },null,null,false)
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        },null,null,false);
                       } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                } else if (code==8) {
                  var dataId1=$(this).data("id1");
                  var dataId2=$(this).data("id2");
                  var treeSelect1 = null;
                  var treeSelect2 = null;
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑地源水泵的输送系数配置（夏季）',
                    width: 480,
                    height: 350,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 7}),
                    onShow: function () {
                        treeSelect1 = app.initInputSelect(29,1,dataId1);
                        treeSelect2 = app.initInputSelect(30,1,dataId2);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var powercost=22;
                        var energy=21;
                        var nodes = treeSelect2.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId!=null){
                            if(element.pId[0]=="c"){
                              dataConfigIds.push(element.id);
                            }else if(element.pId[0]=="d"){
                              deviceIds.push(element.id);
                            }
                          }
                        })
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+energy + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            nodes = treeSelect1.getCheckedNodes(true);
                            deviceIds = [];
                            dataConfigIds = [];
                            nodes.forEach(element=>{
                              if(element.pId!=null){
                                if(element.pId[0]=="c"){
                                  dataConfigIds.push(element.id);
                                }else if(element.pId[0]=="d"){
                                  deviceIds.push(element.id);
                                }
                              }
                            })
                            global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+powercost + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initDiyuanrebeng();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            },null,null,false)
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        },null,null,false);
                       } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                } else if (code==9) {
                  var dataId1=$(this).data("id1");
                  var dataId2=$(this).data("id2");
                  var dataId3=$(this).data("id3");
                  var treeSelect1 = null;
                  var treeSelect2 = null;
                  var treeSelect3 = null;
                  Dialog.open({
                    theme: "addFormDialog",
                    id: 'dialog-example11',
                    title: '编辑地源水泵的输送系数配置（冬季）',
                    width: 480,
                    height: 400,
                    modal: true,
                    context: self,
                    content: template("addFormTpl",{type: 9}),
                    onShow: function () {
                        treeSelect1=app.initInputSelect(29,1,dataId1);
                        treeSelect2=app.initInputSelect(30,1,dataId2);
                        treeSelect3=app.initInputSelect(31,1,dataId3);
                    },
                    onClosed: function () {
                      $(".dropdownSelect-menu").remove();
                    },
                    button: [
                      { id: "mybtn1", label: "保存", intent: "primary", focus: true, click: function () {
                        var fenzibeijianshu=27;
                        var fenzijianshu=23;
                        var fenmu=26;
                        var nodes = treeSelect1.getCheckedNodes(true);
                        var deviceIds = [];
                        var dataConfigIds = [];
                        nodes.forEach(element=>{
                          if(element.pId!=null){
                            if(element.pId[0]=="c"){
                              dataConfigIds.push(element.id);
                            }else if(element.pId[0]=="d"){
                              deviceIds.push(element.id);
                            }
                          }
                        })
                        global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+fenzibeijianshu + "&deviceIds="+deviceIds + "&dataConfigIds="+dataConfigIds,response=>{
                          if(response.success){
                            nodes = treeSelect2.getCheckedNodes(true);
                            deviceIds = [];
                            dataConfigIds = [];
                            nodes.forEach(element=>{
                              if(element.pId!=null){
                                if(element.pId[0]=="c"){
                                  dataConfigIds.push(element.id);
                                }else if(element.pId[0]=="d"){
                                  deviceIds.push(element.id);
                                }
                              }
                            })
                            global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+fenzijianshu + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                              if(response.success){
                                nodes = treeSelect3.getCheckedNodes(true);
                                deviceIds = [];
                                dataConfigIds = [];
                                nodes.forEach(element=>{
                                  if(element.pId!=null){
                                    if(element.pId[0]=="c"){
                                      dataConfigIds.push(element.id);
                                    }else if(element.pId[0]=="d"){
                                      deviceIds.push(element.id);
                                    }
                                  }
                                })
                                global.post("/admin/statisticsConfig/statisticsConfig/config?projectId="+currProjectId+"&statisticsTypeId="+fenmu + "&deviceIds="+deviceIds+ "&dataConfigIds="+dataConfigIds,response=>{
                                  if(response.success){
                                    Dialog.toast("操作成功", {"intent":"success"});
                                    app.initDiyuanrebeng();
                                  }else{
                                    Dialog.toast(response.message, {"intent":"warn"});
                                  }
                                },null,null,false)
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            },null,null,false)
                          }else{
                            Dialog.toast(response.message, {"intent":"warn"});
                          }
                        },null,null,false);
                       } },
                      { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                  });
                }
            });
            // 单个删除
            $(document).on('click', ".del-btn", function () {
              var type = $(this).attr("type");
              var dataConfigId = $(this).attr("dataConfigId");
              var rateTypeId=$(this).attr("rateTypeId");
              var machineGroupId=$(this).attr("machineGroupId");
                Dialog.open({
                    title: "<span class='aidicon aidicon-alert-circle-outline aidicon-warning'></span><span class='lineClamp2'>确定删除该信息吗？</span>",
                    width: 320,
                    height: 'auto',
                    modal: true,
                    content: '<div class="padding-left-large-5">您确定要删除吗？删除后状态不可恢复。</div>',
                    button: [
                        { id: "mybtn1", label: "确认", intent: "primary", focus: true, click: function () {
                          if(type=="commonDataConfig"){
                            global.delete("/admin/statisticsConfig/dataConfig/delete/"+dataConfigId,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initCommonDataItem();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            })
                          }else if(type=="rateType"){
                            global.delete("/admin/statisticsConfig/powercostRateConfig/delete/"+rateTypeId,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initPowercostRate();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            })
                          }
                          else if(type=="machineGroup"){
                            global.delete("/admin/statisticsConfig/machineGroup/delete/"+machineGroupId,response=>{
                              if(response.success){
                                Dialog.toast("操作成功", {"intent":"success"});
                                app.initMachineGroup();
                              }else{
                                Dialog.toast(response.message, {"intent":"warn"});
                              }
                            })
                          }
                        } },
                        { id: "mybtn2", label: "取消", click: function () { } }
                    ]
                });
            });
            // 隐藏多选下拉
            $(document).on('click', '#dropdownSelect-treeSelect-multi29', function () {
              $("#treeDemo-30").parent(".dropdownSelect-menu").hide();
              $("#treeDemo-31").parent(".dropdownSelect-menu").hide();
            })
            $(document).on('click', '#dropdownSelect-treeSelect-multi30', function () {
              $("#treeDemo-29").parent(".dropdownSelect-menu").hide();
              $("#treeDemo-31").parent(".dropdownSelect-menu").hide();
            })
            $(document).on('click', '#dropdownSelect-treeSelect-multi31', function () {
              $("#treeDemo-30").parent(".dropdownSelect-menu").hide();
              $("#treeDemo-29").parent(".dropdownSelect-menu").hide();
            })
            // 切换项目
            $(document).on('click', '.project-list li:not(".active")', function () {
              $(this).addClass("active").siblings("li").removeClass("active");
              currProjectId = $(this).attr("projectId");
              //初始化通用数据项列表
              app.initCommonDataItem();
              //初始化系统能耗
              app.initSystemPowercost();
              //初始化制冷/供暖量
              app.initCoolingAndHeatingEnergy();
              //初始化能耗占比
              app.initPowercostRate();
              //初始化机组能效
              app.initMachineGroup();
              //初始化三项数据
              app.initThreeRealTime();
              //初始化系统能效
              app.initSystemEnffiency();
              //初始化冷热水泵输送系数
              app.initLengreshuibeng();
              //初始化地源热泵输送系统
              app.initDiyuanrebeng();
            })
        }

    };
    return app;
});